Good Morning everyone,
OleAutoObj objStyles
OleAutoObj objStyle
oleGet(objWordDocument_g, "Styles", objStyles)
int count = -1
oleGet(objStyles, "count", count)
int i
for( i = 1; i <= count; i++ )
{
put( oleAutoArgs_g, i )
oleMethod( objStyles, "Item", oleAutoArgs_g, objStyle )
oleGet( objStyle, "Name", oleGetReturnString_g )
print oleGetReturnString_g "\n"
}
Boitumelo - Thu May 26 02:57:28 EDT 2011 |
Re: Get Styles from Word Template
Good morning, oleGet(objWord, "ActiveDocument", objDoc)
OleAutoObj objWord = null
OleAutoObj objDoc = null
OleAutoObj objStyles = null
OleAutoObj objStyle = null
OleAutoArgs oleAutoArgs_g
int count = -1
int i
string oleGetReturnString_g = ""
objWord = oleGetAutoObject("Word.Application")
if (null objWord){objWord = oleCreateAutoObject("Word.Application")}
if (!null objWord)
{ // Successfully opened Word
oleGet(objWord, "ActiveDocument", objDoc)
if (!null objDoc)
{ // Successfully got handle on Active Document
oleGet(objDoc, "Styles", objStyles)
if (!null objStyles)
{ // Successfully got handle on styles
oleGet(objStyles, "count", count)
for( i = 1; i <= count; i++ )
{ // Loop through styles
oleAutoArgs_g = create
put(oleAutoArgs_g, i)
oleMethod(objStyles, "Item", oleAutoArgs_g, objStyle)
if (!null objStyle)
{ // Successfully got handle on one style
oleGet(objStyle, "NameLocal", oleGetReturnString_g)
print oleGetReturnString_g "\n"
} // Successfully got handle on one style
else {print "No handle on style " i "\n"}
delete oleAutoArgs_g
} // Loop through styles
} // Successfully got handle on styles
else {print "No handle on styles\n"}
} // Successfully got handle on styles
else {print "No handle on Active Document\n"}
} // Successfully opened Word
else {print "No handle on Word\n"}
objStyles = objDoc."Sytles"
which is easier to write and read. Probably someone can give a hint here. |
Re: Get Styles from Word Template Thanks :) |